import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
import { BrowserRouter } from "react-router-dom";

import store from './redux/store';

const root = ReactDOM.createRoot(document.getElementById("root"));

root.render(<BrowserRouter><App /></BrowserRouter>);

//subscribe 订阅的意思.  设置 redux 状态更新的回调
store.subscribe(() => {
  //该函数会在 redux 状态更新之后, 自动执行
  root.render(<BrowserRouter><App /></BrowserRouter>);
});

